  function ocell=concat_cell(bspace,varargin)
% function ocell=concat_cell(bspace,varargin);
%
% Concatenate column cells of the same dimension 
% into a single column cell 
% If bspace=1 then a blnak space is added between two cells 
%    bspace=0 no space 
% 
% Alejandro Justiniano 6/30/04 
% ================================================
if nargin < 2 
    error('Need at least two inputs') 
end 
if bspace~= 0 && bspace~= 1 
    error('input bspace must be either zero or one') 
end 
n=length(varargin); 
t1=varargin{1}; 
r=size(t1,1); 
ocell=cell(r,1); 
ii=1; 
for ii=1:n 
    tcell=varargin{ii}; 
    if iscell(tcell) == 0 
        error('All inputs must be cells') 
    end
    if size(tcell,1) ~= r; 
        error('All cells must have the same dimension') 
    end 
    jj=1; 
    for jj=1:r
        if bspace== 1 
            ocell(jj)={ [ocell{jj},' ',tcell{jj} ] }; 
        else
            ocell(jj)={ [ocell{jj},tcell{jj} ] };
        end    
    end
end 
